package com.example.baseweb.common;

import lombok.Data;
import java.util.List;

@Data
public class PageResponse<T> {
    private List<T> content;
    private long total;
    private int pages;
    private int size;
    private int current;

    public PageResponse() {}

    public PageResponse(List<T> content, long total, int pages, int size, int current) {
        this.content = content;
        this.total = total;
        this.pages = pages;
        this.size = size;
        this.current = current;
    }

    public static <T> PageResponse<T> of(List<T> content, long total, int size, int current) {
        int pages = (int) Math.ceil((double) total / size);
        return new PageResponse<>(content, total, pages, size, current);
    }
} 